<%-- 
    Document   : groupPermission
    Created on : Jul 4, 2012, 2:08:06 PM
    Author     : VANANH
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/popup.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/pushscreen.js"></script>

    </head>
    <script type="text/javascript" language="javascript">
        $j = jQuery.noConflict();
        $j(document).ready(function(){    
            $j('.keysearch').live('keyup',function(){
                if($j('.keysearch').val() == ""){
                    $j('.sourceItem').show();
                                   
                }else{
                    $j('.sourceItem').hide();
                    $j('.sourceItem').each(function(){
                        html = $j(this).html();
                        if(   ununicode(html).indexOf(  ununicode($j('.keysearch').val()) ) > -1    )  {
                            $j(this).show();
                        }else{
                            $j(this).hide();
                        }
                    });
                }

            });
                
            $j('.keysearch1').live('keyup',function(){
                if($j('.keysearch1').val() == ""){
                    $j('.destinationItem').show();
                    $j('.sourceItem').show();
                                   
                }else{
                    $j('.destinationItem').hide();
                    $j('.sourceItem').hide();
                    $j('.destinationItem').each(function(){
                        html = $j(this).html();
                        if(   ununicode(html).indexOf(  ununicode($j('.keysearch1').val()) ) > -1    )  {
                            $j(this).show();
                        }else{
                            $j(this).hide();
                        }
                    });
                    $j('.sourceItem').each(function(){
                        html = $j(this).html();
                        if(   ununicode(html).indexOf(  ununicode($j('.keysearch1').val()) ) > -1    )  {
                            $j(this).show();
                        }else{
                            $j(this).hide();
                        }
                    });
                }

            });
        });
    </script>
    <style type="text/css">
        .message{
            color: red;
            float: left;
            margin-top: 35px;
            text-align: center;
            text-transform: uppercase;
            width: 100%;
        }
        .destinationItem{
            height: 33px;
            font-size: 11px;
        }
        .sourceItem{
            height: 33px;
            font-size: 11px;
        }
        .sourceItem:hover{
            background: #E8E8E8!important;
        }
        .destinationItem:hover{
            background: #E8E8E8!important;
        }
        .sourceItemHeader{
            background-color: #4884B5;
            color: white;
        }
        .desNameItemHeader{
            background-color: #4884B5;
            color: white;
        }
        
        .abc123{
            margin-top: 0px !important;
        }
        .keysearch {
            float: left;
            margin-left: 38px;
        }
        .keysearch1 {
            float: right;
    margin-right: 27px;
    margin-top: 12px;
    width: 277px !important;
          
        }
        .buttonsearch1 {
       background: url("../images/btn_search.png") no-repeat scroll 7px 4px white;
    border: 0 none;
    color: #FFFFFF;
    cursor: pointer;
    float: right;
    height: 20px;
    margin-left: 682px;
    margin-top: 13px;
    position: absolute;
    text-transform: uppercase;
    width: 28px;
        }
        .searchClient{
            height: 30px;
            width: 100%;
            

        }
    </style>
    <body style=" float:left; width:auto; height:auto; margin:0px;">
        <f:view>
            <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
            <a4j:form id="group">
                <h:outputText value="<div class='permission' lang='#{loginSession.right.MENU_ADM_VIEW}'></div>" escape="false"/>
                <div class="popup" style="height:475px; width:739px">
                    <div class="popup-header">
                        <div class="title"> <h:outputText value="#{locale.group_right}"/></div>
                    </div>
                    <div class="popup-content">
                        <div class="main_content">
                            <div class="MasterdataContentScroll2" style="height:160px">
                                <div class="searchClient" >
                                    <h:inputText value="" onfocus="if(this.value=='Nhập từ khóa')this.value='';" styleClass="keysearch1" />
                                    <div style="float: left;" class="buttonsearch1"></div>

                                </div>
                                <div align="center" id="workPhaseContainer" style="min-width:888px">
                                    <h:panelGroup  id="employeeGroupContainer">
                                        <div style="padding-top: 22px;">

                                            <div class='idEmployee' lang='1'></div>
                                            <div class="left" style="float: left;width: 43%;margin-left: 25px;">
                                                <div id="sourceDiv" class="sourcePanel" style="font-size: 12px;overflow-x:hidden">
                                                    <div class="sourceItemHeader" style="width : 100%;" ><h:outputText value="#{locale.emloyee_not_in_right}"/>

                                                    </div>
                                                    <a4j:repeat value="#{q200Controller.listQ200L}" var="item" rowKeyVar="row">
                                                        <div class="sourceItem" style="background-color: <h:outputText rendered="#{row%2!=0}" value="#FFFFFF"/><h:outputText rendered="#{row%2==0}" value="#E0EFFC"/>" ondblclick="moveRight(this)" onclick="changeStyleLeft(this)" lang="<h:outputText value="#{item.fn100}"/>">
                                                            <h:outputText value="#{item.hoten}"/></br><h:outputText value="#{item.nv106}"/>
                                                        </div>
                                                    </a4j:repeat>
                                                </div>

                                            </div>
                                            <div class="buttonDiv" style="margin-left:8px;margin-right: 8px;min-width:95px">
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveBtnRight()"><h:outputText value="#{locale.add}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveBtnLeft()"><h:outputText value="#{locale.delete}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveAllRight()"><h:outputText value="#{locale.add_all}"/></div><br/><br/>
                                                <div class="buttonPicklist" style="color:#58585A" onclick="moveAllLeft()"><h:outputText value="#{locale.delete_all}"/></div>
                                            </div>
                                            <div class="right" style="float: left;width: 31%;min-width:263px"  >
                                                <div id="destinationDiv" class="destinationPanel" style="font-size: 12px;overflow-x:hidden" >
                                                    <div class="destinationItemHeader">
                                                        <div class="desNameItemHeader"  style="width:100%;" >
                                                            <span style="margin-top: 3px;padding-left: 1px;">
                                                                <h:outputText value="#{locale.employee_in_right}"/>

                                                            </span>

                                                        </div>
                                                    </div>

                                                    <a4j:repeat value="#{q200Controller.listQ200R}" var="item" rowKeyVar="row">
                                                        <div class='destinationItem' style="background-color: <h:outputText rendered="#{row%2!=0}" value="#FFFFFF"/><h:outputText rendered="#{row%2==0}" value="#E0EFFC"/>" ondblclick='moveLeft(this)' onclick='changeStyleRight(this)'>
                                                            <div class="desNameItem" style="border-right:0px;width:259px" lang="<h:outputText value="#{item.fn100}"/>">
                                                                <h:outputText value="#{item.hoten}"/></br><h:outputText value="#{item.nv106}"/>
                                                            </div>

                                                        </div>
                                                    </a4j:repeat>


                                                </div>
                                            </div>
                                        </div>
                                    </h:panelGroup>
                                </div>

                            </div>
                            <div class="message"><span style="color: white;">A</span></div>
                        </div>
                    </div>

                    <div class="popup-footer">
                        <h:inputHidden value="#{q200Controller.pq350}" id="pq350"/>
                        <div class="buttonsave" onclick="jQuery.fancybox.close(); "  ><span><h:outputText value="#{locale.close}"/></span></div>
                        <div class="buttonsave" onclick="saveEmployeeToGroup()"> <span><h:outputText value="#{locale.save}"></h:outputText></span></div>

                    </div>
                </div>
            </a4j:form>
        </f:view>

    </body>
</html>
<script type="text/javascript">
    $j(document).ready(function(){
        yhight = ($j('.popup').height()-90)+"px" ;
        $j('.main_content').css('height',yhight );
        $j('.popup_content').css('height',yhight  );
    });
    function saveEmployeeToGroup() {
        var idemploy = "";
        showPleaseWait();
        var pq350=$j('#group\\:pq350').val();
        if(pq350!=null){
            $j(".message").text("Cập nhật thành công!");
        }
        $j('.desNameItem').each(function() {
            idemploy += $j(this).attr('lang');
            idemploy += "_";
        });
        if(idemploy != "_"){
            $j.post("groupActionQ200.jsp?pq350="+pq350+"&idemploy="+idemploy,function(data){
                if(data!=null){
                   
                    hidePleaseWait();
                }
            });
        }
    }
</script>
